package com.stylefeng.guns.rest.common;

public class CurrentUser {

    //线程绑定的存储空间，不要存放太多信息，这里选择只存userId
    private static final ThreadLocal<String> threadLocal =
            new ThreadLocal<>();

    public static void saveUserId(String userId){
      threadLocal.set(userId);
    }

    public static String getUserId(){
        return threadLocal.get();
    }

//    public static void saveUserInfo(UserInfoModel model){
//        threadLocal.set(model);
//    }
//
//    public static UserInfoModel getCurrentUser(){
//        return threadLocal.get();
//    }

    //手动清理和不手动清理差别不大，所以就不写清理方法了
}
